<template>
  <button @click="emitMousedown">
    子组件触发绑定在子组件上的mousedown方法
  </button>
  <h3>子组件Demo上的name:{{ name }}</h3>
  <hr />
  <Demo2 v-bind="$attrs"></Demo2>
</template>
<script>
import Demo2 from './Demo2.vue'
export default {
  nanme: 'Demo',
  components: { Demo2 },
  props: ['name'],
  emits: ['click', 'mousedown'],
  setup(props, content) {
    console.log('props:', props)
    console.log('content:', content.attrs)
    function emitMousedown() {
      content.emit('mousedown', '子组件触发的')
    }
    return {
      emitMousedown,
    }
  },
}
</script>
